#pragma once
#include <iostream>
enum
{
    DivData = 1,
    ModData,
    Default
};
std::string opers = "+-*/%";
class task
{

public:
    task() {}
    task(int x, int y, char op) : data1_(x), data2_(y), op_(op), result_(0), exitcode_(0)
    {
    }
    void run()
    {
        switch (op_)
        {
        case '+':
            result_ = data1_ + data2_;
            break;
        case '-':
            result_ = data1_ - data2_;

            break;
        case '*':
            result_ = data1_ * data2_;

            break;
        case '/':
        {
            if (data2_ == 0)
                exitcode_ = DivData;
            else
                result_ = data1_ / data2_;
        }
        break;
        case '%':
        {
            if (data2_ == 0)
                exitcode_ = DivData;
            else
                result_ = data1_ % data2_;
        }
        break;
        default:
            exitcode_ = Default;
            break;
        }
    }
    void operator()()
    {
        run();
    }
    std::string Getresult()
    {
        std::string r;
        r += std::to_string(data1_);
        r += op_;
        r += std::to_string(data2_);
        r += "=";
        r += std::to_string(result_);
        r += '[';
        r += std::to_string(exitcode_);
        r += "]";
        return r;
    }
    std::string show()
    {
        std::string r;
        r += std::to_string(data1_);
        r += op_;
        r += std::to_string(data2_);
        r += "=?";
        return r;
    }

private:
    int data1_;
    int data2_;
    char op_;
    int result_;
    int exitcode_;
};